<template>
  <div class="confirm">
    <div class="confirm_item">
      <div class="confirm_item-title">{{item.entname}}</div>
      <div class="confirm_item-info">
        <span>
          业务类型：{{item.opertype | dict('CD01')}}
        </span>
        <span>
          申请时间：{{item.appdate}}
        </span>
      </div>
      <Input type="textarea" v-model="message" placeholder="请填写退回原因" :rows="8"></Input>
    </div>
    <div class="confirm_retreat">
      <Button type="primary" @click="sureReturn">确定退回</Button>
    </div>
    <div class="confirm_bottom">
      <MyFooter />
    </div>
  </div>
</template>

<script>
  import MyFooter from '../../components/MyFooter.vue'
  import request from '../../utils/request'
  export default {
    data() {
      return {
        message: '',
        item: {}
      }
    },
     methods: {
      sureReturn() {
        request.get('/interface/confirm/doBack.do', {
          gid: this.item.gid,
          msg: this.message,
          confirmid: this.item.confirmid
        }).then(response => {
          if (response.data.result === 'error') {
            this.$ErrorAlert(response.data.message)
          } else {
            // 成功逻辑
            this.$router.push({name: 'BusinessConfirmList'})
          }
        })
      }
    },
    mounted() {
      this.item = JSON.parse(sessionStorage.getItem('confirm'))
    },
    components: {
      MyFooter
    }
  }

</script>

<style lang="scss">
  .confirm {
    position: relative;
    min-height: 100%;
    background: #f3f3f3;
    padding-bottom: 2.25rem;
    &_item {
      padding: 0.54rem;
      background: #fff;
      &-title {
        color: #00b3ff;
        overflow: hidden;
        white-space: nowrap;
        border-bottom: 1px solid #eaeaea;
        padding-bottom: 0.22rem;
        margin-bottom: 0.14rem;
      }
      &-info {
        display: flex;
        justify-content: space-between;
        font-size: 0.5rem;
        color: #7d7d7d;
        overflow: hidden;
        white-space: nowrap;
        padding: 0.36rem 0;
      }
      .ivu-input-wrapper {
        width: 100% !important;
      }
    }
    &_retreat {
      padding: 0.72rem;
      button {
        display: block;
        margin: 0 auto;
        font-size: 0.57rem;
      }
    }
    &_bottom {
      position: absolute;
      width: 100%;
      bottom: 0;
    }
  }

</style>
